﻿/// <reference path="../jquery.min.js" />
/// <reference path="../rsseasy.min.js" />
/// <reference path="../rsseasy.app.js" />


$(function () {
    var myintegralpage = $("#myintegralpage"), myintegrallist = $("#myintegrallist");
    myintegralpage.load(function () {

        $("#myintegralpage h3,#myjifen h3").html("个人积分 " + RssUser.Data["integral"] + "分");

        new Ajax("integral/my/list").keyvalue("myid", RssUser.Data.myid).getJson(function (json) {
            var html = "", myintegrallist = $("#myintegrallist");
            $.each(json, function (key, rows) {
                html += '<tr><td>' + new Date(rows["shijian"] * 1000).toString() + '</td><td>' + rows["source"] + '</td><td>' + rows["integral"] + '</td></tr>';
            });
            myintegrallist.html(html);
        });
    });

    var myjifenlist = $("#myjifenlist");
    $("#myjifen").load(function () {
        var html = "";
        new Ajax("integral/rank").get(function (data) {
            $.each(data, function (key, rows) {
                html += '<tr><td></td><td></td><td>' + rows["realname"] + '</td><td>' + (key + 1) + '</td><td>' + rows["integral"] + '</td></tr>';
            });
            myjifenlist.html(html);
        });
    });
});